package com.feng.springcloud.cfgbeans;

import com.netflix.eureka.registry.rule.InstanceStatusOverrideRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.core.RandomLoadBalancer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ConfigBean {

    @Bean
    //负载均衡开启：ribbon
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

    /**
     * RoundRobinRule 轮询
     * RandomRule 随机
     * AvailabilityFilteringRule
     * WeightedResponseTimeRule
     * RetryRule
     * BestAvailableRule
     * ZoneAvoidanceRule
     * @return
     */
//    @Bean
//    public IRule myRule() {
//        return new RandomRule();
//    }
}
